#include <zmq.hpp>
#include <unistd.h>
#include <stdio.h>
#include "util.h"

int main(int argc, const char *argv[])
{
    zmq::context_t context(1);
    zmq::socket_t skt(context,ZMQ_PUB);
    skt.bind("tcp://*:20000");
    u64 data[2];
    memset(data, 0, sizeof(data));

    while(true){
	data[0]++;
	data[1] = ms();
        int size = sizeof(data);
        zmq::message_t msg(size);
        memcpy(msg.data(), data, size);
        skt.send(msg);
        printf("%s: %ld %ld\n", argv[0], data[0], data[1]);
        usleep(10000);
    }
    return 0;
}
